<?php

/**
 * Location form.
 *
 * @package    tsantek-shop
 * @subpackage form
 * @author     Tomislav Šantek
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class LocationForm extends BaseLocationForm
{
  public function configure()
  {
    $city = new sfWidgetFormDoctrineJQueryAutocompleter(array(
        'url' => '/autocomplete_city',
        'model' => 'City',
        'value_callback' => 'findOneById'
        ));

    $this->setWidget('city_id', $city);

    $this->widgetSchema->moveField('country_numcode', sfWidgetFormSchema::FIRST);
    $this->widgetSchema->moveField('city_id', sfWidgetFormSchema::AFTER, 'country_numcode');
    $this->widgetSchema->moveField('street', sfWidgetFormSchema::AFTER, 'city_id');


    $this->setValidator('street', new sfValidatorString(array('max_length' => 255, 'required'=>false)));
	  $this->widgetSchema['street']->setLabel('Ulica i kućni broj');
	  $this->widgetSchema['city_id']->setLabel('Grad');
	  $this->widgetSchema['country_numcode']->setLabel('Država');

  }
}
